// 商品管理追加属性按钮
layui.use(['layer', 'form'], function(){
  var layer = layui.layer
  ,form = layui.form;
});

var html = '<a class="layui-btn layui-btn-warm layui-btn-xs attr" lay-event="attr"><i class="fa fa-cube">属性规格</i></a>';
$('td.column-__actions__').prepend(html);

$(".attr").on('click', function () {
    // 找到这一列的goods_id
    var goods_id = $(this).siblings('.grid-row-delete').attr('data-id');

            layer.open({
                type: 2
                , title: '规格属性'
                , content: '/goods/attribute/' + goods_id
                , maxmin: true
                , area: ['1080px', '700px']
                , btn: ['确定', '取消']
                , yes: function (index, layero) {
                    //点击确认触发 iframe 内容中的按钮提交
                    var submit = layero.find('iframe').contents().find("#layuiadmin-app-form-edit");
                    submit.click();
                }
            });
});
